﻿using UIFramwork.Utils;
using UnityEngine;
using UnityEngine.UI;


namespace UIFramwork.Factory.Component
{
    /// <summary>
    /// 
    /// </summary>
    public class UIMask : MonoBehaviour
    {
        Image m_UIMask;


        public void Init()
        {
            if (m_UIMask == null)
            {
                m_UIMask = gameObject.transform.GetComponent<Image>();

                if (m_UIMask == null)
                {
                    m_UIMask = gameObject.AddComponent<Image>();
                    this.SetColor(Color.grey);
                }
            }

            LayoutUtil.SetTransform(transform);
            LayoutUtil.SetOffset(transform, Vector2.zero, Vector2.zero);
            LayoutUtil.SetSibling(transform, 0);
        }


        public void SetColor(Color color)
        { 
            this.m_UIMask.color = color;
        }
    }
}
